<ion-header>
  <ion-navbar>
    <ion-title>文字转语音</ion-title>
    <ion-buttons>
      <button ion-button (click)="dismiss()">
        <ion-icon name="arrow-back"></ion-icon>
      </button>
    </ion-buttons>
  </ion-navbar>
</ion-header>
<ion-content >
  <ion-segment [(ngModel)]="chooseType" color="primary" (ionChange)="segmentChanged($event)">
    <ion-segment-button value="handle">
      所需插件
    </ion-segment-button>
    <ion-segment-button value="test">
      真机调试
    </ion-segment-button>
  </ion-segment>
  <div *ngIf="chooseType=='handle'">
    <ion-list>
    <ion-item-sliding *ngFor="let item of showArr">
      <ion-item>
          {{item.text}}
      </ion-item>
      <ion-item-options side="right">
          <button ion-button> {{item.tips}}</button>
        </ion-item-options>
    </ion-item-sliding>
    </ion-list>
    <textarea disabled rows="10">
      import { TextToSpeech } from '@ionic-native/text-to-speech';

      constructor(private tts: TextToSpeech) { }
      
      ...
      
      this.tts.speak('Hello World')
        .then(() => console.log('Success'))
        .catch((reason: any) => console.log(reason));
    </textarea>
  </div>
  <div *ngIf="chooseType=='test'">
    <ion-item>
      <ion-label color="primary" fixed>文本</ion-label>
     <ion-input type="text"  [(ngModel)]="text"></ion-input>
    </ion-item>
      <button ion-button full (click)="goTextToSpeech()">开始转换</button>
  </div>
</ion-content>
